#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream> 
using namespace std;
int n, m, a[1000000], b[1000000], c[1000000];
char o;
int js(int t)
{
    return t & (-t);
}
int jk(int x, int y)
{
    for (; x <= n; x += js(x))
        c[x] += y;
}
int vn(int x)
{
    int ans = a[x];
    for (; x; x -= js(x))
        ans += c[x];
    return ans;
}
int main()
{
    scanf("%d%d", &n, &m);
    for (int i = 1; i <= n; i++)
        scanf("%d", &a[i]);
    for (int i = 1; i <= m; i++)
    {
        scanf(" %s", &o);
        int y, z, v;
        if (o == 'C')
        {
            scanf("%d%d%d", &y, &z, &v);
            jk(y, v);
            jk(z + 1, -v);
        }
        else if (o == 'Q')
        {
            scanf("%d", &y);
            printf("%d\n", vn(y));
        }
    }
    return 0;
}